/**
 * 
 */
package com.sj.szxy.courseschedule.entity;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import com.sj.szxy.courseschedule.entity.course.Course;

/**
 * 班级的排课时间
 * @author Yi Ping
 * @date 2018年3月29日 下午3:20:05 
 * @since 1.0.0
 *
 */
public class ClassSegment extends Segment{
	
	private Set<AdministrativeClass> administrativeClasses = new HashSet<>();
	
	/**
	 * @param weekday
	 * @param ordinal
	 * @param noon
	 */
	public ClassSegment(int weekday, int ordinal, Noon noon) {
		super(weekday, ordinal, noon);
	}
	
	
	
	public boolean support(Course course) {
		return  administrativeClasses.containsAll(course.getAdministractiveClasses()) && super.support(course) ;
	}
	
	public Set<AdministrativeClass> getAdministrativeClasses() {
		return administrativeClasses;
	}
	
	
	@Override
	public boolean isFree() {
		return super.isFree() && administrativeClasses.size()>0;
	}

	
	
	public void removeAdministractiveClass(AdministrativeClass clazz) {
		this.administrativeClasses.remove(clazz);
	}
	
	public void removeAllAdministractiveClasses(Collection<AdministrativeClass> classes) {
		this.administrativeClasses.removeAll(classes);
	}
	
	
	public void addAdministractiveClass(AdministrativeClass clazz) {
		this.administrativeClasses.add(clazz);
	}
	
	public void addAllAdministractiveClass(Collection<AdministrativeClass> classes) {
		this.administrativeClasses.addAll(classes);
	}
	
	
}
